package com.scs.dao;

import com.scs.pojo.StudentLeave;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface StudentLeaveMapper {
    /**
     *学生请假
     */
    @Insert("insert into leaveForm (userId,realName,classes,startTime,endTime,leaveReason,rejectInfo,status,counselorId) " +
            "values (#{userId},#{realName},#{classes},#{startTime},#{endTime},#{leaveReason},#{rejectInfo},#{status},#{counselorId})")
    int insertInfo(StudentLeave studentLeave);

    /**
     * 老师批假
     */
    @Update("update leaveForm set rejectInfo=#{arg0},status=#{arg1} where leaveId=#{arg2}")
    int updateStatus(String rejectInfo,Integer status,Integer leaveId);

    /**
     * 获取请假申请
     */
    @Select("select * from leaveForm where status=#{arg0} and counselorId=#{arg1}")
    List<StudentLeave> getLeaveOfStu(Integer status,String counselorId);

    /**
     * 获取请假申请
     */
    @Select("select * from leaveForm where counselorId=#{arg1}")
    List<StudentLeave> getMyLeaveRecordOfStu(String counselorId);

    /**
     * 获取我的各个状态的请假
     */
    @Select("select * from leaveForm where userId=#{arg0}")
    List<StudentLeave> getMyLeaveInfo(String userId) ;

}
